home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 694 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  949 b 

  1. Path: crl.crl.com!not-for-mail
  2. From: bobfry@crl.com (Robert Fry)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Packing characters
  5. Date: 8 Jan 1996 09:05:46 -0800
  6. Organization: CRL Dialup Internet Access
  7. Message-ID: <4crita$ek@crl.crl.com>
  8. References: <4cp6st$phk@news.isc.rit.edu>
  9. NNTP-Posting-Host: crl.com
  10.  
  11. css0958@osfmail.isc.rit.edu (SWANSON) writes:
  12.  
  13. >Problem: I have a value like this: XXX.YYY where the X and Y's
  14. >are numbers, like in an ip address. The values are 0-255.
  15.  
  16. >What is the best way to store them so they take up the least
  17. >amount of room? Later I need to traansmit them in a packet
  18. >header, so space is an issue.
  19.  
  20. Personally, I don't feel that 'the best way to store' a value is 
  21. necessarily the way that takes the 'least amount of room'. In this case, 
  22. that may be true, but it is never necessarily so.
  23.  
  24. If you're sure the numbers will always be 0-255, why not declare a 
  25. structure with room for an unsigned char for each number?
  26.  
  27.   Bob
  28.